package com.zoe.onelink.logging.trace.autoconfigure;

import com.zoe.onelink.logging.trace.feign.processor.OnelinkFeignContextBeanPostProcessor;
import feign.Client;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.netflix.ribbon.SpringClientFactory;
import org.springframework.cloud.openfeign.ribbon.CachingSpringLoadBalancerFactory;
import org.springframework.cloud.openfeign.ribbon.LoadBalancerFeignClient;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * <p>标题: </p>
 * <p>描述: </p>
 * <p>版权: Copyright (c) 2022</p>
 * <p>公司: 智业软件股份有限公司</p>
 *
 * @version: 1.0
 * @author: ruansheng
 * @date: 2022-09-14
 */
@Configuration(proxyBeanMethods = false)
@ConditionalOnProperty(name = "spring.sleuth.feign.processor.enabled", matchIfMissing = true)
@ConditionalOnClass({LoadBalancerFeignClient.class, SpringClientFactory.class, Client.class})
public class OnelinkTraceFeignAutoConfiguration {

    @Bean
    static OnelinkFeignContextBeanPostProcessor onelinkFeignContextBeanPostProcessor(BeanFactory beanFactory) {
        return new OnelinkFeignContextBeanPostProcessor(beanFactory);
    }
}
